package com.antball.dd.bridge;

public class NewTvControl extends AbstractControl {
    private int ch = 0;
    private boolean ison = false;
    private int prech = 0;
    public NewTvControl(ControlImplementor mControl) {
        super(mControl);
    }
    @Override
    public void Onoff() {
        if (ison) {
            ison = false;
            implementor.Off();
        } else {
            ison = true;
            implementor.On();
        }
    }

    @Override
    public void nextChannel() {
        prech = ch;
        ch++;
        implementor.setChannel(ch);
    }
    @Override
    public void preChannel() {
        prech = ch;
        ch--;
        if (ch < 0) {
            ch = 200;
        }
        implementor.setChannel(ch);
    }

    //设置频道
    public void setChannel(int nch) {
        prech = ch;
        ch = nch;
        implementor.setChannel(ch);
    }

    //扩展的返回按钮
    public void Back() {
        implementor.setChannel(prech);
    }
}
